package com.guigu.qingcheng.controller;

import com.guigu.qingcheng.entity.TbAd;
import com.guigu.qingcheng.service.AdServiceFeign;
import com.guigu.qingcheng.service.GoodsServiceFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

@Controller
public class IndexController {

    @Autowired
    private AdServiceFeign adServiceFeign;

    @Autowired
    private GoodsServiceFeign goodsServiceFeign;

    @RequestMapping({"/index","/"})
    public String index(Model model) {
        List<TbAd> lbt = adServiceFeign.findByPosition("web_index_lb");
        List<Map> categoryTree = goodsServiceFeign.findCategoryTree();
        model.addAttribute("lbt", lbt);
        model.addAttribute("categoryList", categoryTree);
        return "index";
    }

}
